/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.bridge.major;

import ru.jSkyRoom.interfaces.major.Enchantment;
import ru.jSkyRoom.interfaces.major.FormList;
import ru.jSkyRoom.finder.FinderByFormId;
import skyproc.ENCH;
import skyproc.FormID;
import skyproc.genenums.CastType;
import skyproc.genenums.DeliveryType;

/**
 *
 * @author Rakev
 */
public class EnchantmentBridge extends MagicItemBridge<ENCH> implements Enchantment {

    public EnchantmentBridge(ENCH adapting) {
        super(adapting);
    }

    @Override
    public Enchantment getBaseEnchantment() {
        FormID baseEnchantmentID = getRawObject().getBaseEnchantment();
        return getFinderFactory().createEnchantmentFinder().find(baseEnchantmentID);
    }

    @Override
    public void setBaseEnchantment(Enchantment baseEnchantment) {
        FormID baseEnchantmentID = getIdProducer().produce(baseEnchantment);
        getRawObject().setBaseEnchantment(baseEnchantmentID);
    }

    @Override
    public FormList getWornRestrictions() {
        FormID formListID = getRawObject().getWornRestrictions();
        return getFinderFactory().createFormListFinder().find(formListID);
    }

    @Override
    public void setWornRestrictions(FormList restriction) {
        FormID restrictionID = getIdProducer().produce(restriction);
        getRawObject().setWornRestrictions(restrictionID);
    }

    @Override
    public int getBaseCost() {
        return getRawObject().getBaseCost();
    }

    @Override
    public void setBaseCost(int cost) {
        getRawObject().setBaseCost(cost);
    }

    @Override
    public boolean getFlag(ENCH.ENCHFlag flag) {
        return getRawObject().get(flag);
    }

    @Override
    public void setFlag(ENCH.ENCHFlag flag) {
        getRawObject().set(flag, true);
    }

    @Override
    public void unsetFlag(ENCH.ENCHFlag flag) {
        getRawObject().set(flag, false);
    }

    @Override
    public CastType getCastType() {
        return getRawObject().getCastType();
    }

    @Override
    public void setCastType(CastType type) {
        getRawObject().setCastType(type);
    }

    @Override
    public int getChargeAmount() {
        return getRawObject().getChargeAmount();
    }

    @Override
    public void setChargeAmount(int amount) {
        getRawObject().setChargeAmount(amount);
    }

    @Override
    public DeliveryType getDeliveryType() {
        return getRawObject().getDeliveryType();
    }

    @Override
    public void setDeliveryType(DeliveryType type) {
        getRawObject().setDeliveryType(type);
    }

    @Override
    public ENCH.EnchantType getEnchantType() {
        return getRawObject().getEnchantType();
    }

    @Override
    public void setEnchantType(ENCH.EnchantType type) {
        getRawObject().setEnchantType(type);
    }

    @Override
    public float getChargeTime() {
        return getRawObject().getChargeTime();
    }

    @Override
    public void setChargeTime(float time) {
        getRawObject().setChargeTime((float) time);
    }
}
